import { defineStore } from 'pinia'
import { ref } from 'vue'
// enterprise模块 token setToken removeToken

export const useEnterpriseStore = defineStore(
  'enterprise',
  () => {
    /*token*/
    const token = ref('')
    const setToken = (newToken) => {
      token.value = newToken
    }
    const removeToken = () => {
      token.value = ''
    }
    /* enterprise基本信息*/
    const enterprise = ref({})
    const setEnterpriseUsername = (username) => {
      enterprise.value.username = username
    }
    const setEnterprise = (obj) => {
      enterprise.value = obj
    }
    const knowledge_base = ref('defaultBase')
    return {
      token,
      setToken,
      removeToken,
      enterprise,
      setEnterprise,
      setEnterpriseUsername,
      knowledge_base
    }
  },
  {
    persist: true
  }
)
